invokeAsync

public abstract CompletableFuture<T> invokeAsync<T>(@Nullable() JsObject object, Array<Object> args)

Invokes this function on the given object with the specified args.

This method does not block the current thread execution and executes the function asynchronously.

Returns a new CompletableFuture that is completed when the function finishes its execution. If the function throws an exception, the future is completed with JsException with the same error message that will be printed to the JavaScript console. If the browser is closed during the function execution, the future will be canceled.

Since

7.31

Parameters

object

the JavaScript object to invoke this function on. Pass null to invoke the function as a global function.

args

the list of input arguments

<T>

the result of the JavaScript function execution

Throws

when args contains an unsupported type

when the JavaScript object is already disposed or invalid